#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#define ll long long
#define ull unsigned long long
using namespace std;
int n,Q,a[10000];
struct Data{
	bool key;
	int x,v;
}q[1000000];
bool cmp(int x,int y){return x>y;}
void function1(){
	for(int i=0;i<Q;i++){
		if(q[i].key==0){
			if(a[q[i].x]!=q[i].v){
				return ;
			}
		}
	}
	for(int i=0;i<Q;i++){
		if(q[i].key)
			cout<<a[q[i].x]<<endl;
	}
	exit(0);
}
void function2(){
	for(int i=0;i<Q;i++){
		if(!q[i].key){
			a[q[i].x]=q[i].v;
		}
		else{
			int b[100000];
			for(int j=0;j<n;j++){
				b[j]=a[j];
			}
			for(int j=i;j<=n;j++)
				if(b[j]<a[q[i].x]){
					cout<<j<<endl;break;
				}
			sort(a+1,a+n+1,cmp);
		}
	}
	exit(0);
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>Q;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=0;i<Q;i++){
		cin>>q[i].x;
		q[i].key=q[i].x-1;
		cin>>q[i].x;
		if(!q[i].key){
			cin>>q[i].v;
		}
	}
	sort(a+1,a+n+1,cmp);
	function1();
	function2();
	return 0;
}
